package com.hframe.type;

import com.hframe.data.Base;

import java.util.ArrayList;


public class TArray<T extends Base> extends com.hframe.type.T<ArrayList<T>> {

    public TArray(Class<T> className) {
        this.object = new ArrayList<T>();
        this.className = className;
    }

    public TArray(ArrayList<T> object, Class<T> className) {
        super(object);
        this.className = className;
    }

    public T remove(int index) {
        if (null == object)
            return null;
        return object.remove(index);
    }

    public boolean remove(Object obj) {
        if (null == object)
            return false;
        return object.remove(obj);
    }

    public int size() {
        if (null == object)
            return 0;
        return object.size();
    }

    public boolean add(T objcet) {
        if (null == object)
            return false;
        return object.add(objcet);
    }

    public boolean addObject(Object objcet) {
        if (null == object)
            return false;
        return object.add((T) objcet);
    }

    public void add(int index, T objcet) {
        if (null == object)
            return;
        object.add(index, objcet);
    }

    public T get(int index) {
        if (null == object || 0 > index || object.size() <= index)
            return null;

        return object.get(index);
    }

    public T set(int index, T value) {
        if (null == object)
            return null;
        return object.set(index, value);
    }


}
